<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 计算力扣银行的钱 -->
    <script>
      var totalMoney = function (n) {
        let ans = 0
        let monday = 1
        for (let i = 1; i <= n; i++) {
          if (i > 1 && i % 7 === 1) {
            // 取余判断是周一
            monday = Math.floor(i / 7) + 1 // 取是第几个下周一，重置周一开始存的钱
          }
          ans += monday
          monday++
        }
        return ans
      }
      console.log(totalMoney(4))
    </script>
  </body>
</html>
